<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript" src="<s:url value="/js/directory/site.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/commonAddress.js"/>"></script>

<div id="filter" >
        <s:url var="getURL" action="getURL"  namespace="/RemoteAccess"/>
        <s:form action="list" cssClass="tableFilter">

            <tr>
                <th colspan="2" class="tableTitle">
                    <h5>Search</h5>
                </th>
            </tr>

            <s:textfield label="Institution" name="institucion" value="%{institucion}"/>

            <s:hidden label="Country" name="address.country" id="addressCountry" value="%{address.country}"/>
            <s:hidden label="Province" name="address.province" id="addressProvince" value="%{address.province}"/>
            <s:include value="../address/addressview.jsp"/>

            <s:doubleselect
                    id="areas"
                    label="Therapeutic Area"
                    cssClass="areass"
                    list="languageMap.keySet()"
                    listKey="id"
                    listValue="name"
                    name="therapeuticAreaLAF.id"
                    value="%{therapeuticAreaLAF.id}"
                    doubleId="specialities"
                    doubleHeaderKey="-1" doubleHeaderValue="Choose Specialty"
                    doubleListKey="id"
                    doubleListValue="name"
                    doubleName="specialtyLAF.id"
                    doubleValue="%{specialtyLAF.id}"
                    doubleList="languageMap.get(top)"/>

            <tr>
                <td colspan="2" class="centeredButtons">
                    <s:submit value="Search" name="filter" theme="simple"/>
                    <s:submit action="create" value="New" theme="simple" onclick="resetForms();"/>
                    <button onclick="generateURLWindow('<s:property value="getURL"/>'); return false;">New Link</button>
                </td>
            </tr>
        </s:form>
    </div>

<s:if test="!list.isEmpty()">
<div id="table_content">
        <table>
            <thead>
                <tr>
                    <th>Institution</th>
                    <th>Country</th>
                    <th>Region</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
            <s:iterator value="list" var="translator">
                <tr>
                    <th><s:property value="institucion"/></th>
                    <th><s:property value="%{centroAddresses[0].address.country}"/></th>
                    <th><s:property value="%{centroAddresses[0].address.province}"/></th>
                    <th>
                        <s:form action="create" method="POST">
                            <s:hidden value="%{id}" name="editableCenterId"/>
                            <a onclick="$(this).closest('form').submit()"><img src="<s:url value="/images/edit.png"/>" title="Edit" alt="Edit"></a></TH>
                        </s:form>
                    </th>
                </tr>
            </s:iterator>

            <tbody>
        </table>
</div>
</s:if>
<script type="text/javascript">
    var list = true;
</script>
<script type="text/javascript">
    $('#center').css({"color":"#EE5102","fontWeight":"bold"});
</script>